package io.finer.erp.jeecg.bas.service;

import io.finer.erp.jeecg.bas.dto.ZrkOrderProductDTO;
import io.finer.erp.jeecg.bas.dto.ZrkShopCustomerDTO;
import io.finer.erp.jeecg.bas.dto.ZrkShopOrderDTO;
import io.finer.erp.jeecg.bas.dto.ZrkShopTotalDTO;
import io.finer.erp.jeecg.bas.entity.ZrkOrderProduct;
import io.finer.erp.jeecg.bas.entity.ZrkShoporder;
import io.finer.erp.jeecg.bas.vo.CreateZzOrderVO;
import io.finer.erp.jeecg.bas.vo.OrderProductVO;
import io.finer.erp.jeecg.bas.vo.OrderVO;

import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.IService;
import java.io.Serializable;
import java.math.BigDecimal;
import java.util.Collection;
import java.util.List;

import org.apache.ibatis.annotations.Param;
import org.jeecg.common.api.vo.Result;

/**
 * @Description: 商城订单信息表
 * @Author: jeecg-boot
 * @Date:   2020-08-22
 * @Version: V1.0
 */
public interface IZrkShoporderService extends IService<ZrkShoporder> {

	/**
	 * 添加一对多
	 * 
	 */
	public void saveMain(ZrkShoporder zrkShoporder,ZrkOrderProduct zrkOrderProduct) ;
	
	/**
	 * 修改一对多
	 * 
	 */
	public void updateMain(ZrkShoporder zrkShoporder,ZrkOrderProduct zrkOrderProduct);
	
	/**
	 * 删除一对多
	 */
	public void delMain (String id);
	
	/**
	 * 批量删除一对多
	 */
	public void delBatchMain (Collection<? extends Serializable> idList);
	
	public ZrkShoporder selectByActiveDayPlan();
	public ZrkShoporder selectByActiveMonthPlan();
	public ZrkShoporder selectByActiveYearPlan();
	
	public ZrkShoporder selectNewOrOldCustomer(String customerId);

	/**
	 * @Description 根据orderNo 查询订单
	 * @param orderNo 对应shopOrder字段
	 * @return
	 * Create at: 2020-11-25 14:27:25
	 * @author: duany
	 * Revision:
	 *    2020-11-25 14:27:25 - first revision by duany
	 *        
	 */
	public ZrkShoporder selectByOrderCode(String orderNo);

	/**
	 * @Description 添加订单
	 * @param orderVo
	 * @return
	 * Create at: 2020-12-15 20:50:36
	 * @author: duany
	 * Revision:
	 *    2020-12-15 20:50:36 - first revision by duany
	 *        
	 */
	public Result<?> addOrder(OrderVO orderVo);

	/**
	 * 销售订单拆单
	 * @param id
	 * @return
	 */
	public Result<?> recallOrder(String id);

	
	/**
	 * 作废
	 * @param id
	 * @return
	 */
	public Result<?> delOrder(String id);
	
	Page<ZrkShopCustomerDTO> getCustomerAndProduct(IPage<ZrkShopCustomerDTO> page,@Param("customerName") String customerName);
	
	/**
	 * 根据不同客户获取该客户产品的总平方，总金额
	 * @param page
	 * @param customerName
	 * @return
	 */
	Page<ZrkShopTotalDTO> getShopTotal(Page<ZrkShopTotalDTO> page,@Param("customerName") String customerName,@Param("orderTimeBegin") String orderTimeBegin,@Param("orderTimeEnd") String orderTimeEnd);

	/**
	 * 下单人销量统计查询
	 * @param creatBy
	 * @param orderTimeBegin
	 * @param orderTimeEnd
	 * @return
	 */
	Page<ZrkOrderProductDTO> querySalesVolumeByUser(Page<ZrkOrderProductDTO> page,@Param("createBy") String[] createBy,@Param("orderTimeBegin") String orderTimeBegin,@Param("orderTimeEnd") String orderTimeEnd);
//	Page<ZrkShopTotalDTO> getShopTotal(Page<ZrkShopTotalDTO> page,@Param("customerName") String customerName);

	/*
	 * 根据客户id获取未核销完成的销售单
	 * @author libaow
	 * @date 2021/4/17 10:27
	 * @param customerId
	 * @return java.util.List<io.finer.erp.jeecg.bas.entity.ZrkShoporder>
	 */
	List<ZrkShoporder> getOrderByCustomerId(String  customerId);

	List<ZrkShoporder> getOrderHxYByCustomerId(String  customerId);

	Page<ZrkShopOrderDTO> listByModel(Page<ZrkShopOrderDTO> page,ZrkShoporder model);

	/**
	 * 生成车间任务单
	 * @param createZzOrderVO
	 * @return
	 */
	Result<?> createZzOrder(CreateZzOrderVO createZzOrderVO);
	
	boolean updateCreateBy(ZrkShoporder zrkShoporder);

}
